<?php
$path = $_SERVER['DOCUMENT_ROOT']."/laptrak/images/reciept/Laptop/"; // change the path to fit your websites document structure
$fullPath = $path.$_GET['receipt'];
 
    $fsize = filesize($fullPath);
    $path_parts = pathinfo($fullPath);
    $ext = strtolower($path_parts["extension"]);
    switch ($ext) {
        case "txt":
       /* header("Content-type: application/txt"); // add here more headers for diff. extensions
        header("Content-Disposition: attachment; filename=".$path_parts["basename"].";");
		// use 'attachment' to force a download
		 header("Content-length:".$fsize);
         header("Cache-control: private");*/

		 header("Pragma: public");
         header("Expires: 0");
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
         header("Content-Type: application/force-download");
         header("Content-Type: application/octet-stream");
         header("Content-Type: application/download");
         header("Content-Disposition: attachment; filename=".basename($fullPath).";");
         header("Content-Transfer-Encoding: binary");
         header("Content-Length: ".filesize($fullPath));
         readfile($fullPath);
		break;
        default;
        echo "hi";
    }
    //use this to open files directly
   


 
?>